use pumpkin_data::packet::clientbound::PLAY_OPEN_SCREEN;
use pumpkin_util::text::TextComponent;

use pumpkin_macros::packet;
use serde::Serialize;

use crate::VarInt;

#[derive(Serialize)]
#[packet(PLAY_OPEN_SCREEN)]
pub struct COpenScreen<'a> {
    pub sync_id: VarInt,
    pub window_type: VarInt,
    pub window_title: &'a TextComponent,
}

impl<'a> COpenScreen<'a> {
    pub fn new(window_id: VarInt, window_type: VarInt, window_title: &'a TextComponent) -> Self {
        Self {
            sync_id: window_id,
            window_type,
            window_title,
        }
    }
}
